package com.example.jiagoujiexiang.Mapper;


import com.example.jiagoujiexiang.entity.subscribe;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
@Mapper
@Repository
public interface subscribeDao {
    @Select("select * from subscribe")
    public List<subscribe> getSubscribeList();

    @Insert("insert into subscribe(user_id, pet_id,timestamp) values(#{subscribe.user_id},#{subscribe.pet_id},#{subscribe.timestamp})")
    public int addSubscribe(@Param("subscribe")subscribe subscribe);

    @Delete("DELETE FROM subscribe WHERE pet_id = #{pet_id}")
    public int deleSubscribe(@Param("pet_id")int pet_id);

    @Update("UPDATE subscribe SET timestamp = #{subscribe.timestamp} where pet_id = #{subscribe.pet_id}")
    public int updateSubscribe(@Param("subscribe")subscribe subscribe);
}
